02 / 12

What are the different types of Inheritance? (Single, Multilevel, Hierarchical)

Difficulty: 2/10

Types of Inheritance

The common structural forms of inheritance include single, multilevel and hierarchical inheritance. Single inheritance means one child derives from one parent. Multilevel inheritance forms a chain where one derived class becomes the base for another. Hierarchical inheritance has multiple child classes derived from the same parent. Some languages also support multiple inheritance of classes, while Java and C# intentionally restrict class inheritance to avoid ambiguity and complexity.

javascript
  1. 1

    Single: A -> B.

  2. 2

    Multilevel: A -> B -> C.

  3. 3

    Hierarchical: A -> B and A -> C.

  4. 4

    Multiple inheritance: A class derives from multiple parent classes; language support varies.

  5. 5

    Deep inheritance hierarchies can increase coupling and make changes difficult.

Follow-up Questions

  • What is multiple inheritance?
  • Why can deep inheritance become problematic?
  • Which languages support multiple class inheritance?
  • How can composition replace inheritance?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.